$(document).ready(function(){
    selectInterface("");
	$("#submitReqBtn").on("click", function(){
		var httpUrl = $("#httpUrl").val();
    	if (httpUrl == ""){
    		alert("测试服务地址不能为空");
    		return;
    	}
    	
    	var params = $("#params").val();
    	if (params == ""){
    		alert("参数不能为空");
    		return;
    	}
    	
    	$.ajax({
    		type:"post",
    		url:httpUrl,
            data:params, 
            dataType:"json", 
            contentType:"application/json;charset=utf-8",
            success: function(data){
            	 $("#returnResult").val(formatJson(data)); 
            }
        });
	});

});

function selectInterface(v){
	//alert("selectInterface: "+v);
	if (v == ""){
		$("#params").val(formatJson({"cmd" : "hello", "token" : "ABCD"}));
	}else if (v == "1"){
		$("#params").val(formatJson({"cmd" : "login", "params" : { "requestId" : "", "verifyCode": "", "loginName": "superuser", "password": "7fede6be8a61bd6930f0ac90a149e660", "clientType": 0, "clientName":"chrome"}}));
	}else if (v == "2"){
		$("#params").val(formatJson({"cmd" : "orgRegist", "params" : { "requestId" :"","verifyCode":"", "type": "1 or 2", "email": "","contactMan":"","contactTel":"","orgName":"","orgShortName":"", "yyzzFileBase64":"","zzjgdmzFileBase64":"","swdjzFileBase64":"","zzzmclFileBase64List":[""]}}));
	}else if (v == "3"){
		$("#params").val(formatJson({"cmd" : "getDictItemList", "token" : "" , "params" : {"dictType" : "", "parentId" : "0", "active" : "1", "itemGroup" : ""} }));
	} 
}